package double_pointer;

public class moveZeroes2 {
    public void moveZeroes(int[] nums) {
        int left = -1;
        int right = 0;
        while(right < nums.length) {
            if(nums[right] == 0) {
                right++;
            }else {
                int tem = nums[right];
                nums[right] = nums[left+1];
                nums[left+1] = tem;
                left++;
                right++;
            }
        }
    }
}
